import { createRouter, createWebHashHistory} from 'vue-router'
import Layout from '@/layout/index.vue'
const mapRoute = [
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'Login',
    hidden: true,
    meta: { title: '登录页' }
  },
  {
    path: '/',
    redirect: '/dashboard',
    meta: {
      title: '工作台',
      icon: 'dashboard' // 只限一级目录，二级暂时不要写
    },
    component: Layout,
    name: 'PageHome',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        meta: {
          title: '首页'
        },
        component: () => import('@/views/dashboard/index.vue')
      }
    ]
  },
  // {
  //   path: '/chart',
  //   redirect: '/chart/line',
  //   meta: {  title: '可视化图表', icon: 'chart' },
  //   component: Layout,
  //   name: 'Chart',
  //   children: [
  //     {
  //       path: 'line',
  //       name: 'LineChart',
  //       meta: {
  //         title: '折线图'
  //       },
  //       component: () => import('@/views/echarts/LineChart/index.vue')
  //     },
  //     {
  //       path: 'bar',
  //       name: 'BarChart',
  //       meta: {
  //         title: '柱状图'
  //       },
  //       component: () => import('@/views/echarts/BarChart/index.vue')
  //     },
  //     {
  //       path: 'pie',
  //       name: 'PieChart',
  //       meta: {
  //         title: '饼图'
  //       },
  //       component: () => import('@/views/echarts/PieChart/index.vue')
  //     }
  //   ]
  // },
  // {
  //   path: '/table',
  //   redirect: '/table/index',
  //   meta: {  title: '表格',  icon: 'table'  },
  //   component: Layout,
  //   name: 'Table',
  //   children: [
  //     {
  //       path: 'basic',
  //       name: 'TableBasic',
  //       meta: {
  //         title: '基础表格'
  //       },
  //       component: () => import('@/views/table/basic.vue')
  //     },
  //   ]
  // },
  //   {
  //   path: '/setting',
  //   redirect: '/setting/center',
  //   meta: {  title: '设置', icon: 'setting' },
  //   component: Layout,
  //   name: 'Setting',
  //   children: [
  //     {
  //       path: 'center',
  //       name: 'SettingCenter',
  //       meta: {
  //         title: '个人中心'
  //       },
  //       component: () => import('@/views/setting/center.vue')
  //     },
  //     {
  //       path: 'password',
  //       name: 'SettingPassword',
  //       meta: {
  //         title: '重置密码'
  //       },
  //       component: () => import('@/views/setting/password.vue')
  //     }
  //   ]
  // },
  // { path: '/:pathMatch(.*)*', component: () => import('@/views/404/404.vue'), hidden: true }
]

export const dynamicRouter = {
  'layout/Layout': () => import('@/layout/index.vue'),
  'views/echarts/LineChart/index':() => import('@/views/echarts/LineChart/index.vue'),
  'views/echarts/BarChart/index':() => import('@/views/echarts/BarChart/index.vue'),
   'views/echarts/PieChart/index': () => import('@/views/echarts/PieChart/index.vue'),
   'views/table/basic': () => import('@/views/table/basic.vue'),
  'views/setting/center': () => import('@/views/setting/center.vue'),
  'views/setting/password': () => import('@/views/setting/password.vue'),
  'views/404/404': () => import('@/views/404/404.vue')
}

export const routesData = mapRoute

const router = createRouter({
  history: createWebHashHistory(),
  routes: mapRoute
})
export default router
